<script type="text/javascript">
$(function(){
	$.post("inventorymanagement/getUserAndBanch",function(json){
		var activeUser = json.activeUser;
		var userNo=activeUser.userNo;
		var branchNo=activeUser.branchNo;
		$("input[name='operatorNo']").val(userNo);
		$("input[name='branchNoByEmpReceiveBlank']").val(branchNo);	
    });
	$("#receiveBlankCardClassify").change(function(){
		var classFyVal = $("select[name='receiveBlankCardClassify']").val();
		var empNo = $("input[name='empNoByEmpReceiveBlank']").val();
		var empBranch = $("input[name='branchNoByEmpReceiveBlank']").val();
		console.log("classFyVal==>"+classFyVal+"==empBranch=="+empBranch+"==empNo=="+empNo);
		var param = {"classFyVal":classFyVal,"empBranch":empBranch,"empNo":empNo};
		$.post("inventoryMagOfBlankRequiredByEmp/getCardInfoByEmpReceivedCard",param,function(json){
			var list = json.cardStockQuantityObj;
			var content = "";
			if(list.length==0){
				content+="<tr><td colspan='8' align='center' >未查询到数据</td></tr>"
			}else{
				for(var i=0;i<list.length;i++){					
					content+="<tr align='center'>"
						     +"<td>"+eval(i+1)+"</td>"
						     +"<td><input name='receiveCardPName' size='10' style='border:0;text-align:center;' readonly='readonly' value='"+list[i].cardPName+"'</td>"
						     +"<td><input name='receiveCardPhysicTypeName' size='10' style='border:0;text-align:center;' readonly='readonly' value='"+list[i].physicTypeName+"'</td>"
						     +"<td>"+list[i].stockQuantity+"</td>";
					//判断库存数量，如果库存为0，则显示领用数量0，只读
					if(list[i].stockQuantity==0){
						content+="<td><input name='receivedQuantity' value='0' size='2' style='border:0;text-align:center;' readonly='readonly'></td>"
					}else{
						content+="<td><input onfocus='removeClass()' onblur='checkQuantity(this)' name='receivedQuantity' value='' size='2' style='text-align:center;'></td>"
					}   
					content+="<td style='display:none;'><input style='border:0;text-align:center;' name='receiveCardPCode' value='"+list[i].cardPCode+"' size='15'></td>"
						    +"<td style='display:none;'><input style='border:0;text-align:center;' name='quantityCompareFlag' value='' size='15'></td>"
						    +"<td style='display:none;'><input style='border:0;text-align:center;' name='receiveCardPhysicType' value='"+list[i].physicType+"' size='15'></td>"
						    +"</tr>";
				}
			}
			$("#EmpReceiveBlankCard").html(content);
			var $p = $("#ByEmpReceiveBlankCard");
			initUI($p);
		})
	});
//	$.post("inventorymanagement/getCardDeliveryReg",getCardDeliveryReg,"json");
	
});

</script>
<div class="pageContent">
	<form method="post" action="inventoryMagOfBlankRequiredByEmp/saveBlankCardApplyByEmp" class="pageForm required-validate" onsubmit="return validateCallback(this,printViewPageAjaxDone);">
		<div class="pageFormContent" >	
			<div class="row" style="padding: 0 10px;">
				<div class="col-md-6 col-sm-12">
					<p>
						<label>卡产品：</label>
						<select  id ="receiveBlankCardClassify" name="receiveBlankCardClassify" class="validRequired">	
							<option value="">请选择</option>
							<option value="2">记名空白预制卡</option>
							<option value="3">不记名卡</option>
				        </select>
					</p>
				</div>
				<div class="col-md-6 col-sm-12">
					<p>
						<label>网点编号：</label> 
						<input  id="branchNoByEmpReceiveBlank" name="branchNoByEmpReceiveBlank" type="text" size="30" readonly="readonly" unselectable="on"/>
					</p>
				</div>
			</div>
			<div class="row" style="padding: 0 10px;">
				<div class="col-md-6 col-sm-12">
					<p>
						<label>员工编号：</label>
						<input  id="operatorNo" name="operatorNo" type="text" size="30" readonly="readonly" unselectable="on"/>	
					</p>
				</div>
				<div class="col-md-6 col-sm-12">
					<p>
						<label>领用员工编号：</label> 
						<input  id="empReceiveBlank" name="empReceiveBlank" type="text" size="30" class="validRequired" />	
						<input type="hidden" id="isInput" name="isInput" value="no"/>	
					</p>
				</div>
			</div>	
			<div id="ByEmpReceiveBlankCard">
				<table class="table" width="70%" >
					<thead>
						<tr align="center">
							<th width="5%">序号</th>
							<th width="25%">卡产品名称</th>
							<th width="20%">卡类型</th>
							<th width="10%" >可领用数量</th>
							<th width="20%" >领用请求数量</th>
						</tr>
					</thead>
					<tbody id="EmpReceiveBlankCard">
				
					</tbody>
				</table>
			</div>
			<div class="formBar">
			<ul> 
				<li>
				<div class="buttonActive" ><div class="buttonContent" ><button  id="saveBlankCardRecord" onclick="return checkQuantityBeforeSubmit()" type="submit">提交</button></div></div>
				</li>
			</ul>
		   </div>				
		</div>
	</form>
</div>

